In the scanning of a medical device, for example, a Cone Beam Computed Tomography (CBCT), in-situ scanning is efficient and precise. However, a collision between a component of the medical device and a patient is likely to occur, which will block the in-situ scanning. Accordingly, it is desirable to avoid the collision between the component and the patient in the in-situ scanning.